//书写品牌管理模块接口
import request from "@/utils/request";
import type { TBannersListResponseData,TBanner } from './type'
enum API {
    //获取已有品牌接口
    URL_BANNERS_LIST = "/v1/m/facade/allBanners",
    // //添加品牌
    URL_BANNER_ADD = '/v1/m/facade/banner',
    URL_BANNER_UPDATE = '/v1/m/facade/banner/',

    //删除已有品牌
    URL_BANNER_DELETE = '/v1/m/facade/banner/'
}

export const reqBannersList = () => request.get<any, TBannersListResponseData>(API.URL_BANNERS_LIST);
// //添加与修改已有品牌接口方法
export const reqAddOrUpdateBanner = (data: TBanner) => {
    //修改已有品牌的数据
    if (data.id) {
        return request.put<any, any>(API.URL_BANNER_UPDATE+data.id, data);
    } else {
        //新增品牌 
        return request.post<any, any>(API.URL_BANNER_ADD, data);
    }
}

// //删除某一个已有品牌的数据
export const reqDeleteBanner = (id: number) => request.delete<any, any>(API.URL_BANNER_DELETE + id)